public class Practice {
    public static void main(String[] args) {
        StringBuilder stringBuilder = new StringBuilder("cat");
        String s = stringBuilder.toString();
        System.out.println(s);
    }
    public static void main9(String[] args) {
        StringBuilder s = new StringBuilder("cat");
        s.append("33").append("小七");
        s.append("11.21");
        System.out.println(s);

       /* //字符串的逆置
        s.reverse();
        System.out.println(s);*/

    }
    public static void main8(String[] args) {
        String s = "helloWorld";
        s += "ok";
        System.out.println(s);
       /* String s1 = "ok";
        System.out.println(s+" "+s1);*/
    }
    public static void main7(String[] args) {
        String s = " +beautiful   ";
        String s1 = s.trim();
        System.out.println(s1);
    }
    public static void main6(String[] args) {
        String s = "beautiful";
        String s1 = s.substring(3,6);
        System.out.println(s1);
    }
    public static void main5(String[] args) {
        String str = "name= John & age= 18";
        //多个分隔符
        String[] s1 = str.split("=");
        for (int i = 0; i < s1.length; i++) {
          String[] s2 = s1[i].split("&");
           /* for (int j = 0; j < s2.length; j++) {
           System.out.println(s2[j]);
            }*/
            for (String s3 : s2){
                System.out.println(s3);
            }
        }
    }
    public static void main4(String[] args) {
        String s = "This cat,beautiful";
        String[] s1 = s.split(" " ,2);
        for (int i = 0; i < s1.length; i++) {
            System.out.println(s1[i]);
        }
    }
    public static void main3(String[] args) {
        String s = "This is a white cat";
        String s1 = s.replaceFirst("is","99");
        System.out.println(s1);
    }
    public static void main2(String[] args) {
        String s = String.format("%d-%d-%d",2022,11,21);
        System.out.println(s);//格式化
    }
    public static void main1(String[] args) {
        String s = "Hello,World";
        char[] arr1 = s.toCharArray();
        System.out.println(arr1);
//        for (int i = 0; i < arr1.length; i++) {
//            System.out.print(arr1[i]+" ");
//        }
    }
}
